import requests
import json



def testMessage(username):
    url = "http://test-notify.csdn.net/v1/im/send/message/batch"
    payload = {
       "fromUsername": username,
       "toUsernames": "cpongo8",
       "type": 3,
       "flag": "graphic",
       "attach": {
          "title": "呐呐呐呐呐呐呐呐呐呐",
          "content": "新年好，CSDN祝您兔年心想事成，大展宏兔！我们CSDN平台和CSDN的用户在这里发红包庆祝新年<https://bbs.csdn.net/?type=4&header=0&utm_medium=notify.im.test.1022538.a&username=miffy2014>，请来发红包，抢红包吧！2023年带来了很多新的机会，你抓住了么？首先，请你看看你的学习成就：https://edu.csdn.net/me?utm_medium=notify.im.test.1022538.a&username=miffy2014 我们希望为你打造一个专业的技术成就名片。另外，请看我们的高质量博客专栏：https://blog.csdn.net/rank/list/column?utm_medium=notify.im.test.1022538.a&username=miffy2014 一定有适合你学习的内容！",
          "url": "https://live.csdn.net/room/alitech2017/r0FLpmmG?utm_medium=distribute.app_letter_persion.540533.nonecase"
       },
       "bizLine": "qa",
       "bizSubLine": "qa"
    }
    headers = {
       'Cookie': 'dc_session_id=10_1670485130453.594856; uuid_tt_dd=10_28967210260-1670485130453-727381; dc_session_id=10_1686724800334.573128',
       'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
       'Content-Type': 'application/json'
    }
    response = requests.request("POST", url,verify=False, headers=headers, data=json.dumps(payload))
    print(response.text)

if __name__ == '__main__':
    for i in range(1,50):
        testMessage(str(i))